<script>
  var rotateString = function(s, goal) {
    if (s.length !== goal.length) {
      return false;
    }
    if (s === goal) {
      return true;
    }
    for(let i = 0; i < s.length - 1; i++){
      s = s.substring(1, s.length) + s[0];
      console.log(s)
      if (s === goal) {
        return true;
      }
    }
    return false;
  };

  function rotateString (a, b) {
    if (a.length !== b.length) {
      return false;
    }
    const str = a + a;
    return str.includes(b)
  }

  console.log(rotateString("abcde", "cdeab"))
  console.log(rotateString("abcde", "abced"))
</script>